package com.zhihuitong.meeting.base;

import java.lang.ref.Reference;
import java.lang.ref.WeakReference;

/**
 * 作者： guoyuan
 * 时间 2017/8/30.
 * 文件描述：抽象Presenter类，提供给Activity与具体业务处理的管理类,T 表示View 層的抽象接口,用於和Presenter進行業務交互
 * 版本号：V 1.0
 **/

public abstract class BasePresenter<V> {
    protected Reference<V> viewRefer;

    public V mView;


    protected int pageNum = 1;//页码
    protected int pageSize = 20;//页长

    public BasePresenter(V view) {
        attachView(view);
        mView = getView();
    }

    public void attachView(V view) {
        viewRefer = new WeakReference<V>(view);
    }

    public V getView() {
        return viewRefer.get();
    }

    public void detailView() {
        if (viewRefer != null) {
            viewRefer.clear();
            viewRefer = null;
        }
    }
}
